/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ept.controller;

import com.ept.controller.util.JsfUtil;
import com.ept.entities.Categorie;
import com.ept.facade.CategorieFacade;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author Khalil
 */
@ManagedBean(name = "categController")
@RequestScoped
public class CategController implements Serializable {

    @EJB
    private CategorieFacade categorieFacade;
    private List<Categorie> list;

    public List<Categorie> getList() {
        return list;
    }

    public void setList(List<Categorie> list) {
        this.list = list;
    }

    /**
     * Creates a new instance of CategController
     */
    public void setCategorieFacade(CategorieFacade categorieFacade) {
        this.categorieFacade = categorieFacade;
    }

    public CategController() {
    }

    @PostConstruct
    private void init() {
        LoginController loginController = (LoginController) FacesAccessor.getManagedBean("loginController");

        list = categorieFacade.findAll();
        //System.out.println(list.size());
    }
}
